<%
    Users user = Trader.getUser(request.getParameter("uid"));
	wstrader.task.home.DailyBasisDiscount task = user.home.daily_basis_disc;

	task.getRequest().setRequest(request);
	task.getResponse().setResponse(response,out);
	
	if (!user.Authenticated()) {
		response.sendRedirect("logon.jsp");
		return;
	}
	((Tasks)task.getOwner()).clearFocus();
	task.setFocus(true);	
	
	Trader.window_width = "90%";	
	
	int dLoop=0;
	ResultSet Rs;
	ResultSet rs;
%>

<%@include file="../header.jsp"%>

<%
	//long focused_id = task.doTask();
	//if (focused_id <= 0) focused_id = 1;
	//Record rc   = task.getRecord("purchase_contract",focused_id);
%>

<link href="style.css" rel="stylesheet" type="text/css">

<script language="javascript">
function doFilter()
{
	var form = document.formMain;
	form.action = "home.daily-basis-d.jsp";
	form.submit();
}

function clickCardView(row)
{
	var form = document.formMain;
	form.action = "home.daily-basis-d.card-view.jsp";
	form.submit();	
}

function cardViewClick(row)
{
	var form = document.formMain;
	form.id.value = row.id;
	dblClick(row);
}
</script>
<style type="text/css">
<!--
.style3 {font-family: Arial}
.style6 {font-size: 12px}
-->
</style>
<form action="" method="post" name="formMain" id="formMain">
  <table width="100%"  border="0" cellspacing="0" cellpadding="0">
    <tr>
      <th colspan="2" align="left" scope="col"><img src="images/discount-dailybasis.jpg" width="400" height="30"></th>
      <th width="2%" scope="col">&nbsp;</th>
      <th width="2%" scope="col">&nbsp;</th>
      <th colspan="4" scope="col"><input type="hidden" name="uid"        id="uid"       value="<%=user.getuid()%>">
        <input type="hidden" name="task_id"    id = "task_id"   value="0">
        <input name="id" type="hidden" id="id" value="0"></th>
    </tr>
    <tr align="left">
      <td colspan="8">
	    <table>
    <tr>
      <td width="150" align="center" bgcolor="#EEEEEE"><strong><span class="style29 style3 style6">Origin</span></strong></td>
      <td width="150" align="center" bgcolor="#EEEEEE"><strong><span class="style29 style3 style6">Quality</span></strong></td>
      <td align="center" bgcolor="#EEEEEE"><strong><span class="style29 style3 style6">Grade</span></strong></td>
      <td align="center" bgcolor="#EEEEEE"><strong></strong></td>
      </tr>
    <tr>
      <td height="32"><select name="origin" size="9" id="origin" onChange="doFilter()" style="font-family:Arial; font-size:11px; width:150px;border:0">
        <option value="0" selected>All</option>
	  	<%
			task.getResponse().setOption("origin_master","name");
			task.getResponse().setSelected("origin");
		%>
      </select>
	  </td>
      <td><select name="quality" size="9" id="quality" onChange="doFilter()" style="font-family:Arial; font-size:11px; width:150px;border:0">
        <option value="0" selected>All</option>
	  	<%
			task.getResponse().setOption("quality_master","name");
			task.getResponse().setSelected("quality");
		%>
      </select>
	  </td>
      <td>
        <select name="grade" size="9" id="grade" onChange="doFilter()" style="font-family:Arial; font-size:11px; width:150px;border:0">
		<option value="0" selected>All</option>
		<%@include file="include/DiscountGradeListView.jsp"%>
		</select>
</td>
      <td>&nbsp;
	  </td>
      </tr>
	  
	  </table>	  </td>
    </tr>
    <tr>
      <td colspan="8">	  <table width="100%"  border="1" cellspacing="0" cellpadding="0">
        <tr bordercolor="#EEEEEE">
          <td width="6%" rowspan="3" align="center" bordercolor="#FFFFFF" bgcolor="#EEEEEE"><strong><span class="style29 style3 style6">&nbsp;</span></strong><strong><span class="style29 style3 style6">Id</span></strong></td>
          <td width="10%" rowspan="3" align="center" bordercolor="#FFFFFF" bgcolor="#EEEEEE"><strong><span class="style29 style3 style6">&nbsp;</span></strong><strong><span class="style29 style3 style6">Origin</span></strong></td>
          <td width="7%" rowspan="3" align="center" bordercolor="#FFFFFF" bgcolor="#EEEEEE"><strong><span class="style29 style3 style6">Quality</span></strong><strong><span class="style29 style3 style6"></span></strong></td>
          <td width="21%" rowspan="3" align="center" bordercolor="#FFFFFF" bgcolor="#EEEEEE"><strong><span class="style29 style3 style6">Grade</span></strong><strong><span class="style29 style3 style6"></span></strong></td>
          <td colspan="16" align="center" bordercolor="#FFFFFF" bgcolor="#EEEEEE" class="style1">Defaults </td>		  
          <td colspan="12" align="center" bordercolor="#FFFFFF" bgcolor="#EEEEEE" class="style1">Screens</td>
          </tr>
        <tr bordercolor="#FFFFFF">
          <td width="4%" colspan="2" align="center" bgcolor="#EEEEEE" class="style1">Black</td>
          <td width="4%" colspan="2" align="center" bgcolor="#EEEEEE"><strong><span class="style29 style3 style6">Broken</span></strong><strong><span class="style29 style3 style6"></span></strong></td>
          <td width="4%" colspan="2" align="center" bgcolor="#EEEEEE"><strong><span class="style29 style3 style6">Blk &amp; Brk </span></strong><strong><span class="style29 style3 style6"></span></strong></td>
          <td width="4%" colspan="2" align="center" bgcolor="#EEEEEE"><strong><span class="style29 style3 style6">Brown</span></strong><strong><span class="style29 style3 style6"></span></strong></td>
          <td width="4%" colspan="2" align="center" bgcolor="#EEEEEE"><strong><span class="style29 style3 style6">&nbsp;</span></strong><strong><span class="style29 style3 style6">Excelsa</span></strong></td>
          <td width="4%" colspan="2" align="center" bgcolor="#EEEEEE"><strong><span class="style29 style3 style6">Moldy</span></strong><strong><span class="style29 style3 style6"></span></strong></td>
          <td width="4%" colspan="2" align="center" bgcolor="#EEEEEE"><strong><span class="style29 style3 style6">FM</span></strong><strong><span class="style29 style3 style6"></span></strong></td>
		  <td width="4%" colspan="2" align="center" bgcolor="#EEEEEE" class="style1">Moist</td>
          <td width="4%" colspan="2" align="center" bgcolor="#EEEEEE" class="style1">Sc18</td>
          <td width="4%" colspan="2" align="center" bgcolor="#EEEEEE" class="style1">Sc16</td>
          <td width="4%" colspan="2" align="center" bgcolor="#EEEEEE" class="style1">Sc14</td>
          <td width="4%" colspan="2" align="center" bgcolor="#EEEEEE" class="style1">Sc13</td>
          <td width="4%" colspan="2" align="center" bgcolor="#EEEEEE" class="style1">Sc12</td>
          <td width="4%" colspan="2" align="center" bgcolor="#EEEEEE" class="style1">Below Sc12 </td>
          </tr>
        <tr bordercolor="#FFFFFF">
          <td align="center" bgcolor="#EEEEEE" class="style1">D</td>
          <td align="center" bgcolor="#EEEEEE" class="style1">A</td>
          <td align="center" bgcolor="#EEEEEE" class="style1">D</td>
          <td align="center" bgcolor="#EEEEEE" class="style1">A</td>
          <td align="center" bgcolor="#EEEEEE" class="style1">D</td>
          <td align="center" bgcolor="#EEEEEE" class="style1">A</td>
          <td align="center" bgcolor="#EEEEEE" class="style1">D</td>
          <td align="center" bgcolor="#EEEEEE" class="style1">A</td>
          <td align="center" bgcolor="#EEEEEE" class="style1">D</td>
          <td align="center" bgcolor="#EEEEEE" class="style1">A</td>
          <td align="center" bgcolor="#EEEEEE" class="style1">D</td>
          <td align="center" bgcolor="#EEEEEE" class="style1">A</td>
          <td align="center" bgcolor="#EEEEEE" class="style1">D</td>
          <td align="center" bgcolor="#EEEEEE" class="style1">A</td>
          <td align="center" bgcolor="#EEEEEE" class="style1">D</td>
          <td align="center" bgcolor="#EEEEEE" class="style1">A</td>
          <td align="center" bgcolor="#EEEEEE" class="style1">D</td>
          <td align="center" bgcolor="#EEEEEE" class="style1">A</td>
          <td align="center" bgcolor="#EEEEEE" class="style1">D</td>
          <td align="center" bgcolor="#EEEEEE" class="style1">A</td>
          <td align="center" bgcolor="#EEEEEE" class="style1">D</td>
          <td align="center" bgcolor="#EEEEEE" class="style1">A</td>
          <td align="center" bgcolor="#EEEEEE" class="style1">D</td>
          <td align="center" bgcolor="#EEEEEE" class="style1">A</td>
          <td align="center" bgcolor="#EEEEEE" class="style1">D</td>
          <td align="center" bgcolor="#EEEEEE" class="style1">A</td>
          <td align="center" bgcolor="#EEEEEE" class="style1">D</td>
          <td align="center" bgcolor="#EEEEEE" class="style1">A</td>		  
          </tr>
<%
dLoop=0;
Rs = task.discount_daily_basis.fetchGradeDiscountList();
Rs.beforeFirst();
if (Rs.next()==true)
{
Rs.beforeFirst();
while (Rs.next())
{
%>
        <tr bordercolor="EEEEEE"id=<%=Rs.getInt("id")%> onDblClick="cardViewClick(this);" onClick="highlightOn(this);">
          <td width="6%" align="center" class="style2"><%=Rs.getInt("id")%></td>
          <td width="10%" align="center" class="style2"><%=task.getFieldValueForId("origin_master","name",Rs.getInt("origin_id"))%></td>
          <td width="7%" align="center" class="style2"><%=task.getFieldValueForId("quality_master","name",Rs.getInt("quality_id"))%></td>
          <td width="21%" align="center" class="style2"><%=Rs.getString("name")%></td>
          <td align="center" class="style2"><%=task.FormatZero(Rs.getFloat("black_discount"),0,"-")%></td>
          <td align="center" class="style2"><%=task.FormatZero(Rs.getFloat("black_allowance"),0)%></td>
          <td align="center" class="style2"><%=task.FormatZero(Rs.getFloat("broken_discount"),0)%></td>
          <td align="center" class="style2"><%=task.FormatZero(Rs.getFloat("broken_allowance"),0)%></td>
          <td align="center" class="style2"><%=task.FormatZero(Rs.getFloat("blk_brk_discount"),0)%></td>
          <td align="center" class="style2"><%=task.FormatZero(Rs.getFloat("blk_brk_allowance"),0)%></td>
          <td align="center" class="style2"><%=task.FormatZero(Rs.getFloat("brown_discount"),0)%></td>
          <td align="center" class="style2"><%=task.FormatZero(Rs.getFloat("brown_allowance"),0)%></td>
          <td align="center" class="style2"><%=task.FormatZero(Rs.getFloat("excelsa_discount"),0)%></td>
          <td align="center" class="style2"><%=task.FormatZero(Rs.getFloat("excelsa_allowance"),0)%></td>
          <td align="center" class="style2"><%=task.FormatZero(Rs.getFloat("moldy_discount"),0)%></td>
          <td align="center" class="style2"><%=task.FormatZero(Rs.getFloat("moldy_allowance"),0)%></td>
          <td align="center" class="style2"><%=task.FormatZero(Rs.getFloat("foreign_matter_discount"),0)%></td>
          <td align="center" class="style2"><%=task.FormatZero(Rs.getFloat("foreign_matter_allowance"),0)%></td>
          <td align="center" class="style2"><%=task.FormatZero(Rs.getFloat("moisture_discount"),0)%></td>
          <td align="center" class="style2"><%=task.FormatZero(Rs.getFloat("moisture_allowance"),0)%></td>
          <td align="center" class="style2"><%=task.FormatZero(Rs.getFloat("sc18_discount"),0)%></td>
          <td align="center" class="style2"><%=task.FormatZero(Rs.getFloat("sc18_allowance"),0)%></td>
          <td align="center" class="style2"><%=task.FormatZero(Rs.getFloat("sc16_discount"),0)%></td>
          <td align="center" class="style2"><%=task.FormatZero(Rs.getFloat("sc16_allowance"),0)%></td>
          <td align="center" class="style2"><%=task.FormatZero(Rs.getFloat("sc14_discount"),0)%></td>
          <td align="center" class="style2"><%=task.FormatZero(Rs.getFloat("sc14_allowance"),0)%></td>
          <td align="center" class="style2"><%=task.FormatZero(Rs.getFloat("sc13_discount"),0)%></td>
          <td align="center" class="style2"><%=task.FormatZero(Rs.getFloat("sc13_allowance"),0)%></td>
          <td align="center" class="style2"><%=task.FormatZero(Rs.getFloat("sc12_discount"),0)%></td>
          <td align="center" class="style2"><%=task.FormatZero(Rs.getFloat("sc12_allowance"),0)%></td>
          <td align="center" class="style2"><%=task.FormatZero(Rs.getFloat("below_sc12_discount"),0)%></td>
          <td align="center" class="style2"><%=task.FormatZero(Rs.getFloat("below_sc12_allowance"),0)%></td>		  
        </tr>
<%
		dLoop=dLoop+1;
}
}
else
{
%>
        <tr bordercolor="#EEEEEE" onDblClick="CView_T(this);" onClick="highlightOn(this);">
          <td width="6%" align="center" class="style3">&nbsp;</td>
          <td width="10%" align="center" class="style3">&nbsp;</td>
          <td width="7%" align="center" class="style3">&nbsp;</td>
          <td width="21%" align="center" class="style3">&nbsp;</td>
          <td align="center" class="style3">&nbsp;</td>
          <td align="center" class="style3">&nbsp;</td>
          <td align="center" class="style3">&nbsp;</td>
          <td align="center" class="style3">&nbsp;</td>
          <td align="center" class="style3">&nbsp;</td>
          <td align="center" class="style3">&nbsp;</td>
          <td align="center" class="style3">&nbsp;</td>
          <td align="center" class="style3">&nbsp;</td>
          <td align="center" class="style3">&nbsp;</td>
          <td align="center" class="style3">&nbsp;</td>
          <td align="center" class="style3">&nbsp;</td>
          <td align="center" class="style3">&nbsp;</td>
          <td align="center" class="style3">&nbsp;</td>
          <td align="center" class="style3">&nbsp;</td>
          <td align="center" class="style3">&nbsp;</td>
          <td align="center" class="style3">&nbsp;</td>
          <td align="center" class="style3">&nbsp;</td>
          <td align="center" class="style3">&nbsp;</td>
          <td align="center" class="style3">&nbsp;</td>
          <td align="center" class="style3">&nbsp;</td>
          <td align="center" class="style3">&nbsp;</td>
          <td align="center" class="style3">&nbsp;</td>
          <td align="center" class="style3">&nbsp;</td>
          <td align="center" class="style3">&nbsp;</td>
          <td align="center" class="style3">&nbsp;</td>
          <td align="center" class="style3">&nbsp;</td>
          <td align="center" class="style3">&nbsp;</td>
          <td align="center" class="style3">&nbsp;</td>		  
        </tr>
<%
}
%>

      </table></td>
    </tr>
    <tr>
      <td width="6%">&nbsp;</td>
      <td width="23%">&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td width="1%" align="right">&nbsp;&nbsp;</td>
      <td width="43%" align="right">&nbsp;</td>
      <td width="11%" align="right">&nbsp;</td>
      <td width="12%" align="center">&nbsp;</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td align="right" valign="middle">&nbsp;&nbsp;</td>
      <td align="right" valign="middle">&nbsp;</td>
      <td align="center" valign="middle">&nbsp;</td>
      <td align="right" valign="middle"><img src="images/cardview.jpg" width="55" height="18" onClick="clickCardView();">&nbsp;</td>
    </tr>
  </table>
 
</form>
<%@include file="../footer.jsp"%>

